import request from '@/config/axios'

// 获取用户目标
export function getUserGoal() {
  return request({
    url: '/user/goals',
    method: 'get'
  })
}

// 设置用户目标
export function setUserGoal(data) {
  return request({
    url: '/user/goals',
    method: 'post',
    data
  })
}

// 更新用户目标
export function updateUserGoal(goalId, data) {
  return request({
    url: `/user/goals/${goalId}`,
    method: 'put',
    data
  })
}

// 删除用户目标
export function deleteUserGoal(goalId) {
  return request({
    url: `/user/goals/${goalId}`,
    method: 'delete'
  })
}

// 获取体重记录
export function getWeightRecords(params) {
  return request({
    url: '/user/weight-records',
    method: 'get',
    params
  })
}

// 添加体重记录
export function addWeightRecord(data) {
  return request({
    url: '/user/weight-records',
    method: 'post',
    data
  })
}

// 获取营养达标率
export function getNutritionAchievement(params) {
  return request({
    url: '/user/nutrition-achievement',
    method: 'get',
    params
  })
} 